package com.guojunyu.exp2.conf;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

class CustomCommandLineRunner implements CommandLineRunner {

    private Environment env;

    public  CustomCommandLineRunner(Environment env){
        this.env = env;
    }

    @Override
    public void run(String... args) {
        System.out.println("Spring Boot自动装配的CommandLineRunner");

        System.out.println("生成一个随机的字符串：".concat(Objects.requireNonNull(env.getProperty("random."))));
    }
}